<template>
	<view>
		<block v-if="isload">
			<view class="container">
				<view class="header">
					<view class="d-starttime">
						申请单据：
						<view v-for="(item, index) in detail.pics" :key="index" class="layui-imgbox">
							<view class="layui-imgbox-img">
								<image :src="item" @tap="previewImage" :data-url="item"></image>
							</view>
						</view>
					</view>
					<view class="d-starttime">
						消费店铺：{{ detail.businessname }}
					</view>
					<view class="d-starttime">
						赠送数量：{{ detail.title }}
					</view>
					<view class="d-starttime">
						消费金额：{{ detail.money }}
					</view>
					<view class="d-starttime">
						申请日期：{{ detail.createtime }}
					</view>

					<view class="d-starttime">
						申请状态：
						<view class="status0" v-if="detail.status == 0">待结算</view>
						<view class="status3" v-if="detail.status == 7">已结算</view>
					</view>
				</view>

			</view>
		</block>
		<loading v-if="loading"></loading>
		<dp-tabbar :opt="opt"></dp-tabbar>
		<popmsg ref="popmsg"></popmsg>
	</view>
</template>

<script>
var app = getApp();
export default {
	data() {
		return {
			opt: {},
			loading: false,
			isload: false,
			menuindex: -1,
			pre_url: app.globalData.pre_url, static_url: app.globalData.static_url,

			detail: [],
			datalist: [],
			pagenum: 1,
			id: 0,
			pagecontent: "",
			title: "",
			sharepic: "",
			nodata: false,
			nomore: false,

			applylist: []
		};
	},
	onLoad: function (opt) {
		this.opt = app.getopts(opt);
		this.getdata();
	},
	onPullDownRefresh: function () {
		this.getdata();
	},
	onShareAppMessage: function () {
		var that = this;
		return this._sharewx({
			title: this.detail.partyname,
			desc: this.detail.partyname,
			pic: this.detail.pic,
			callback: function () {
				that.sharecallback();
			}
		});
	},
	onShareTimeline: function () {
		var that = this;
		var sharewxdata = this._sharewx({
			title: this.detail.partyname,
			desc: this.detail.partyname,
			pic: this.detail.pic,
			callback: function () {

			}
		});
		var query = (sharewxdata.path).split('?')[1] + '&seetype=circle';
		return {
			title: sharewxdata.title,
			imageUrl: sharewxdata.imageUrl,
			query: query
		}
	},
	onReachBottom: function () {
		if (!this.nodata && !this.nomore && this.detail.canpl == 1) {
			this.pagenum = this.pagenum + 1
			//this.getpllist();
		}
	},
	methods: {
		getdata: function () {
			var that = this;
			var id = that.opt.id;
			that.loading = true;
			app.get('Offlineorder/detail', {
				id: id
			}, function (res) {
				that.loading = false;
				that.isload = true
				that.detail = res.detail;
				that.title = res.detail.title;
				that.sharepic = res.detail.pic;

				uni.setNavigationBarTitle({
					title: res.detail.title
				});
			});
		},

		logistics() {
			var that = this
			var orderinfo = that.detail;
			var express_com = orderinfo.express_com
			var express_no = orderinfo.express_no
			var express_content = orderinfo.express_content
			var express_type = orderinfo.express_type
			var prolist = orderinfo.prolist
			console.log(express_content)
			if (!express_content) {
				app.goto('/pagesExt/order/logistics?express_com=' + express_com + '&express_no=' + express_no +
					'&type=' + express_type);
			} else {
				express_content = JSON.parse(express_content);
				for (var i in express_content) {
					if (express_content[i].express_ogids) {

					}
				}
				this.express_content = express_content;
				console.log(express_content);
				this.$refs.dialogSelectExpress.open();
			}
		},
		hideSelectExpressDialog: function () {
			this.$refs.dialogSelectExpress.close();
		},
		orderCollect: function (e) {
			var that = this;
			var orderid = e.currentTarget.dataset.id;
			app.confirm('确定要收货吗?', function () {
				app.showLoading('提交中');
				app.post('Offlineorder/complete', {
					orderid: orderid
				}, function (data) {
					app.showLoading(false);
					app.success(data.msg);
					setTimeout(function () {
						that.getdata();
					}, 1000);
				});
			});
		},
	}
};
</script>
<style>
.header {
	background-color: #fff;
	position: relative;
	display: flex;
	flex-direction: column;
}

.d-pic image {
	width: 100%;
	height: 360rpx;
}

.header .title {
	width: 100%;
	font-size: 28rpx;
	color: #010101;
	font-weight: bold;
	padding: 20rpx 30rpx;
}

.header .artinfo {
	width: 100%;
	font-size: 28rpx;
	color: #8c8c8c;
	font-style: normal;
	overflow: hidden;
	display: flex;
	margin: 10rpx 0;
}

.header .artinfo .t1 {
	padding-right: 8rpx
}

.header .artinfo .t2 {
	color: #777;
	padding-right: 8rpx
}

.header .artinfo .t3 {
	text-align: right;
	flex: 1;
}

.header .subname {
	width: 100%;
	font-size: 28rpx;
	color: #888;
	border: 1px dotted #ddd;
	border-radius: 10rpx;
	margin: 10rpx 0;
	padding: 10rpx
}

.party-itemlist {
	display: flex;
	align-items: center;
	position: relative;
	/* margin-bottom: 12rpx; */
	padding: 20rpx 20rpx;
	background: #fff;
}

.party-itemlist .party-pic {
	width: 80rpx;
	height: 80rpx;
	overflow: hidden;
	background: #ffffff;
	position: relative;
}

.party-itemlist .party-pic .image {
	width: 80rpx;
	height: 80rpx;
	border-radius: 50%;
}

.party-itemlist .party-info {
	width: 65%;
	height: auto;
	overflow: hidden;
	padding: 0 20rpx;
	display: flex;
	flex-direction: column;
	justify-content: space-between
}

.party-itemlist .party-info .p1 {
	color: #222222;
	font-weight: bold;
	font-size: 28rpx;
	line-height: 46rpx;
	display: flex;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow: hidden;
	height: 92rpx;
	align-items: center;
}

.party-itemlist .party-info .price {
	color: #eb544d;
	font-size: 28rpx;
	font-weight: bold;
}

.party-itemlist .party-info .p2 {
	display: flex;
	flex-grow: 0;
	flex-shrink: 0;
	font-size: 24rpx;
	color: #a88;
	overflow: hidden;
	padding-bottom: 6rpx
}

.d-starttime {
	display: flex;
	align-items: center;
	padding: 20rpx 20rpx;
}

.d-starttime image {
	width: 200rpx;
	height: 200rpx;
	margin-right: 12rpx;
}

.apply-btn {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20rpx 40rpx;
}

.apply-add {
	color: #fff;
	background: #ba1f25;
	padding: 18rpx 46rpx;
	border-radius: 38rpx;
	width: 44%;
	text-align: center;
}

.apply-view {
	color: #fff;
	background: #e99e44;
	padding: 18rpx 46rpx;
	border-radius: 38rpx;
	width: 44%;
	text-align: center;
}

.apply-list {
	background-color: #fff;
	height: 100rpx;
	line-height: 100rpx;
	padding: 0rpx 30rpx;
	margin: 20rpx 0rpx 0rpx 0rpx;
	display: flex;
	align-items: center;
}

.apply-list-bg {
	height: 42rpx;
	width: 16rpx;
	border-radius: 24rpx;
	background: #ba1f25;
	margin-right: 16rpx;
}

.apply-list-title {
	color: #010101;
	font-size: 28rpx;
	font-weight: bold;
}

.creattime {
	font-size: 24rpx;
	color: #666;
}

.applysex {
	width: 32rpx;
	height: 32rpx;
	margin-left: 12rpx;
}

.status0 {
	color: royalblue
}

.status3 {
	color: seagreen
}

.status4 {
	color: #eb544d
}

.status5 {
	color: #1296db
}

.status6 {
	color: #ba1f25
}

.view-exp {
	border: 2rpx solid #d6d6d6;
	padding: 8rpx 16rpx;
	font-size: 24rpx;
	color: #999;
	border-radius: 6rpx;
}

.complete {
	background: #eb544d;
	padding: 8rpx 16rpx;
	font-size: 24rpx;
	color: #fff;
	margin-left: 24rpx;
	border-radius: 6rpx;
}
</style>